<template>
  <div class="container">
    <div class="nav">
      <van-nav-bar title="会员等级" @click-left="$router.push('/mine')">
        <template #left>
          <van-icon name="arrow-left" size="1rem" color="black" />
        </template>
      </van-nav-bar>
    </div>
    <div class="header">
      <div class="userInfo">
        <img
          src="https://uniapp.b2b2c.niuteam.cn/upload/upload/user/haedimg/20200615071617159221977755646.png"
          alt
        />
        <div class="userInfoRight">
          <span>15555124010</span>
          <span>当前等级：普通会员</span>
        </div>
      </div>
      <div class="swipeCard">
        <van-swipe indicator-color="white" :loop="false" :show-indicators="true">
          <van-swipe-item v-for="(item,inx) in levelList" :key="inx">
            <div class="card">
              <div class="nowLevel" v-if="item.isNow">当前等级</div>
              <div class="memberTitle">{{item.title}}</div>
              <div class="growthVal">当前成长值：1.00</div>
              <div class="memberProcess">
                <span>0.00</span>
                <div class="process">
                  <van-progress :percentage="1" />
                </div>
                <span>100.00</span>
              </div>
              <img :src="item.img" alt />
            </div>
          </van-swipe-item>
        </van-swipe>
      </div>
    </div>
    <div class="content">
      <dl class="textList">
        <dt>会员权益</dt>
        <dd>普通会员</dd>
      </dl>
      <dl class="textList">
        <dt>成长值规则</dt>
        <dd>1.会员注册，赠送1成长值</dd>
        <dd>2.会员消费订单收货返成长值,比率1%</dd>
        <dd>3.会员签到1天，赠送2成长值；会员签到2天，赠送5成长值；会员签到3天，赠送9成长值；</dd>
      </dl>
    </div>
  </div>
</template>

<script>
import { NavBar, Icon, Swipe, SwipeItem, Progress } from "vant";
export default {
  components: {
    "van-nav-bar": NavBar,
    "van-icon": Icon,
    "van-swipe": Swipe,
    "van-swipe-item": SwipeItem,
    "van-progress": Progress
  },
  data() {
    return {
      levelList: [
        {
          isNow: true,
          title: "普通会员",
          img: "https://uniapp.b2b2c.niuteam.cn/upload/uniapp/level/level_1.png"
        },
        {
          title: "青铜会员",
          img: "https://uniapp.b2b2c.niuteam.cn/upload/uniapp/level/level_2.png"
        },
        {
          title: "白银会员",
          img: "https://uniapp.b2b2c.niuteam.cn/upload/uniapp/level/level_3.png"
        }
      ]
    };
  }
};
</script>

<style lang="less" scoped>
.container {
  height: 100%;
  .header {
    height: 10rem;
    background-color: #313133;
    position: relative;
    .userInfo {
      padding: 0.8rem 0.5rem;
      display: flex;
      position: relative;
      &::after {
        content: "";
        right: 1.8rem;
        top: 1rem;
        position: absolute;
        width: 100%;
        height: 100%;
        background: url("https://uniapp.b2b2c.niuteam.cn/upload/uniapp/level/level_bg.png")
          right top/contain no-repeat;
      }
      img {
        widows: 2.3rem;
        height: 2.3rem;
        border: 2px solid white;
        border-radius: 50%;
      }
      .userInfoRight {
        padding-left: 0.5rem;
        color: white;
        font-size: 0.65rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
      }
    }
    .swipeCard {
      //   height: 4rem;
      left: 0;
      right: 0;
      width: 15rem;
      margin: 0 auto;
      position: absolute;
      .card {
        position: relative;
        height: 7.5rem;
        .nowLevel {
          position: absolute;
          top: 0.8rem;
          left: 0;
          padding: 0.3rem 0.6rem;
          background-color: rgba(0, 0, 0, 0.4);
          font-size: 0.6rem;
          border-radius: 0 1rem 1rem 0;
          color: white;
        }
        .memberTitle {
          font-size: 1.2rem;
          font-weight: 600;
          padding: 2rem 0 1.2rem;
          text-align: center;
          color: white;
        }
        .growthVal {
          text-align: center;
          font-size: 0.65rem;
          color: white;
          font-weight: 600;
          padding-bottom: 0.2rem;
        }
        .memberProcess {
          display: flex;
          align-items: center;
          justify-content: space-around;
          > span {
            font-size: 0.65rem;
            color: white;
            // width: 3rem;
            text-align: center;
            font-weight: 600;
          }
          .process {
            width: 65%;
            // width: calc(100% - 6rem);
          }
        }
        img {
          position: absolute;
          left: 0;
          top: 0;
          height: 100%;
          width: 100%;
          z-index: -1;
        }
      }
    }
  }
  .content {
    padding: 1rem 0.8rem;
    .textList {
      &:nth-child(1) {
        padding-top: 2rem;
      }
      padding: 0.4rem 0.6rem;
      margin: 0;
      dt {
        color: #333;
        font-size: 0.75rem;
        font-weight: 600;
      }
      dd {
        margin: 0;
        color: #898989;
        font-size: 0.65rem;
      }
    }
  }
}
</style>